//
//  ViewController.m
//  blockDemo1
//
//  Created by 李煜 on 2024/5/14.
//

#import "UIView+Block.h"

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIView *a = [UIView new];

    //1.来个管家
    [a addTemp:^(XMPerson * _Nonnull person) {
        //人到了,你小子就叫郑必昌吧
        person.name = @"郑必昌";
    }];
    
    
    
    //多请求
    
    typedef void (^BlockForService)(void);
    typedef void (^BlockForAgreement)(void);
    
    
    // 定义第一个block变量
    void(^blockService)(void) = ^{
        NSLog(@"This is the blockService");
        dispatch_group_t group =         dispatch_group_create();
        
    };
    
    // 定义第二个block变量
    void(^blockAgreement)(void) = ^{
        NSLog(@"This is the blockAgreement");
    };
    
    // 将这两个block变量放入数组
    NSArray<void (^)(void)> *blockArray = @[blockService, blockAgreement];
    
    // 遍历数组并依次调用每个block
    for (void (^block)(void) in blockArray) {
        block();
    }
}

@end
